<?php
namespace Home\Model;

use Think\Model;

class CommentsModel extends Model
{
	protected $_validate = array(
		array('describe','stat','请对商品描述评价!',1,'callback',3),
	    //手机号验证
	    array('transport','stat','请对商品物流评价!',1,'callback',3),
	    array('attitude','stat','请对服务态度评价!',1,'callback'), 

	);
	public function stat($val){
		if($val == 0){
			return false;
		}
	}


	protected $_auto = array(
		
		array('addtime','time',1,'function'),//创建时间
	);

    //不为空
	function chk_require($val){

		$rule = '/\S+/';
		if(!preg_match($rule,$val)){
            return false;
        }
	}


	//手机格式验证
	function chk_phone($phone){

		$rule = '/^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/';
		if(!preg_match($rule,$phone)){
            return false;
        }
	}


	

}
?>